package com.itheima.health.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class TestControlle {

    @GetMapping("addData")
    /*
        hasAnyAuthority: 此处可以填写角色或者权限，拥有其中的某一项即可
     */
    @PreAuthorize("hasAnyAuthority('add')")
    public String add(){
        return "add ok";
    }
    @PreAuthorize("hasAnyAuthority('update')")
    @GetMapping("updateData")
    public String update(){
        return "update ok";
    }
    @PreAuthorize("hasAnyAuthority('del')")
    @GetMapping("delData")
    public String del(){
        return "del ok";
    }
    @PreAuthorize("hasAnyAuthority('find')")
    @GetMapping("findData")
    public String find(){
        return "find ok";
    }
}
